<template>
  <div>
      <h4>员工管理</h4>
       <table border="1" width="600" cellspacing="0">
            <thead><tr><th>编号</th><th>姓名</th><th>电话</th><th>职位</th><th>生日</th><th>操作</th></tr>
            </thead>
            <tbody><tr v-for="em in cutbean.list" :key="em.id">
                    <td>{{em.id}}</td>
                     <td>{{em.name}}</td>
                      <td>{{em.tel}}</td>
                       <td>{{em.job}}</td>
                        <td>{{em.birthDay}}</td>
                         <td><input type="button" value="删除" @click="delEm(em.id)">
                     <input type="button" value="修改" @click="find(em)"></td>
                </tr></tbody>
       </table>
       <a v-for="n in cutbean.pages" :key="n" style="margin-left:10px"
            href="javascript:void(0)" @click="pageClick(n)">{{n}}</a>

        <div>
            职位:<input type="text" v-model="param.job"><br>
            起始生日:<input type="text" v-model="param.startDate"><br>
            结束生日:<input type="text" v-model="param.endDate"><br>
            <input type="button" value="查询" @click="pageClick(1)">
        </div>
  </div>
</template>

<script>
export default {
     props:["cutbean"],
     data(){
        return {
            param:{page:1}
        }
     },
     methods:{
         pageClick(index){
            this.param.page=index;
            this.$emit("findByItem",this.param);
       },
      async delEm(id){
         var info = await  this.ajax.getSubmit("/project/em/del",{id:id});
         if(info == "ok"){
                  alert("删除成功");
                   this.$emit("findByItem",{page:1});
              }
            
       },
       find(em){
           this.$emit("find",em);
       }
     }
}
</script>

<style>

</style>